package jmine.tec.services.test.services;

import jmine.tec.services.ServicesController;
import jmine.tec.services.annotations.ServiceFields;
import jmine.tec.services.api.ActionsEnum;
import jmine.tec.services.api.Service;
import jmine.tec.services.api.ServiceExecutionException;

import org.hibernate.Session;

import bancosys.tec.services.api.AbstractService;

/**
 * @author joao.enomoto
 * 
 * @deprecated testa metodos deprecados
 */
@ServiceFields(action = ActionsEnum.VALIDAR, required = {})
public class ValidationNothingService extends AbstractService<ServicesController> implements TestServiceInterface {
    
    private boolean executed = false;

    private Session session;

    /**
     * executes
     * 
     * @throws ServiceExecutionException ServiceExecutionException
     */
    public void execute() throws ServiceExecutionException {
        this.executed = true;
        this.session = this.getController().getSessionFactory().getCurrentSession();
    }

    /**
     * @return boolean
     */
    public boolean wasExecuted() {
        return this.executed;
    }

    /**
     * @return a sessão utilizada por esse serviço
     */
    public Session getSession() {
        return this.session;
    }

    @Override
    public Service<ServicesController> clone() throws CloneNotSupportedException {
        ValidationNothingService service = (ValidationNothingService) super.clone();
        service.executed = false;
        return service;
    }
}
